﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class admin_SysLogin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (Session["vc"].Equals(txtcode.Text.Trim().ToUpper()))
        {
            AdminLogin login = new AdminLogin();
            if (login.LoginSys(txtname.Text.Trim(),MD5.EncodeMD5(txtpwd.Text.Trim())).Equals("1"))
            {
                Session["admin"] = txtname.Text.Trim();
                Response.Redirect("AddAdminer.aspx");
                Response.Write("<script>window.location.href='AddAdminer.aspx';history.back();</script>");
                
            }
            else
            {
                Label1.Text = "<script>alert('登录信息错误!');window.location.href='SysLogin.aspx';</script>";
            }
        }
        else
        {

            Label1.Text = "<script>alert('验证码错误!');window.location.href='SysLogin.aspx';</script>";
        }
    }
}
